#include "../common/TreeNode.h"

/* 二叉搜索树查找结点 */
TreeNode* search(TreeNode* root, int num) {
    TreeNode* cur = root;
    while (cur != nullptr) {
        if (cur->val < num) cur = cur->right;
        else if (cur->val > num) cur = cur->left;
        else break;
    }
    return cur;
}
